﻿#include <QtDebug>
#include "qbcitarget.h"

QBciTarget::QBciTarget() {}

QBciTarget::QBciTarget(const int &id, const QString &label)
    : QBciTarget() {
  ID = id;
  this->setTargetLabel(label);
//  this->setSetImage(setImagePath);
//  this->setUnsetImage(unsetImagePath);
}

//void QBciTarget::rotate(const qreal &degree) {
//  QTransform transform;
//  transform.rotate(degree);
//  SetImage = SetImage.transformed(transform);
//  UnsetImage = UnsetImage.transformed(transform);
//}

//void QBciTarget::stylePaint(QPainter *painter) {
//  if (Wave && EnableWave) {
//    painter->setOpacity(Wave->value());
//  }
//  if (Status) {
//    painter->drawImage(QRect(X, Y, Width, Height), SetImage);
//  } else {
//    painter->drawImage(QRect(X, Y, Width, Height), UnsetImage);
//  }
//}

void QBciTarget::stylePaint(QPainter *painter){
    render->stylePaint(painter);
    shape->getStatus(Status);
    shape->getGeometry(X, Y, Width, Height);
    shape->stylePaint(painter);
}

QBciRectTarget::QBciRectTarget() {}

QBciRectTarget::QBciRectTarget(const QString &label) : QBciRectTarget() {
  this->setTargetLabel(label);
}

void QBciRectTarget::stylePaint(QPainter *painter) {
  int r, g, b;
  if (Status) {
    r = 33;
    g = 243;
    b = 64;
  } else {
    r = 255;
    g = 255;
    b = 255;
  }
  if (Wave && EnableWave) {
    r *= Wave->value();
    g *= Wave->value();
    b *= Wave->value();
  }
  painter->setBrush(QBrush(QColor(r, g, b)));
  painter->drawRect(X, Y, Width, Height);
}

